<template>
	<view class="list-container bg-f">
		<view class="list-item" v-for="(item, index) in dataList" :key="index">
			<view class="left text-right">
				<view class="fw-700">{{ index + 1 }}.{{ item.name }}</view>
				<view class="date-time">(距离发货约{{ item.day }}天)</view>
			</view>

			<view class="dot" :class="{ active: item.status==1 }"></view>

			<view class="right">
				<view class="content-wrap">
					<view class="status" :class="{ active: item.status==1 }">{{item.status==1?'已完成':"待加工"}}</view>
					<view class="content fs-24 color-9" style="margin-top: 24rpx" v-if="item.datetime">
						完成时间：{{ item.datetime }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				id: ""
			}
		},
		onLoad(o) {
			this.id = o.id
			this.getOrderData()
		},
		methods: {
			async getOrderData() {
				const result = await this.$api.getOrderData({
					id: this.id
				})
				if (result) {
					this.data = result.data
					this.dataList = [{
							name: '型材切割',
							datetime: result.data.stepStatus1 == 1 ? result.data.stepStatusTime1 : "",
							day: 10,
							status:result.data.stepStatus1
						},
						{
							name: '百叶制作',
							datetime: result.data.stepStatus2 == 1 ? result.data.stepStatusTime2 : "",
							day: 8,
							status:result.data.stepStatus2
						},
						{
							name: '玻璃制作',
							datetime: result.data.stepStatus3 == 1 ? result.data.stepStatusTime3 : "",
							day: 6,
							status:result.data.stepStatus3
						},
						{
							name: '成品组装',
							datetime: result.data.stepStatus4 == 1 ? result.data.stepStatusTime4 : "",
							day: 4,
							status:result.data.stepStatus4
						},
						{
							name: '包装检验',
							datetime: result.data.stepStatus5 == 1 ? result.data.stepStatusTime5 : "",
							day: 2,
							status:result.data.stepStatus5
						},
					]

				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.list-container {
		border-radius: 14rpx;
		padding: 40rpx 30rpx;
		margin: 25rpx 30rpx;
	}

	.list-item {
		display: flex;
		min-height: 150rpx;
	}

	.left {
		margin-top: -4rpx;
width: 200rpx;
		.date-time {
			margin-top: 16rpx;
			font-weight: 500;
			font-size: 24rpx;
			color: #ffad42;
		}
	}

	.dot {
		margin-left: 20rpx;
		color: #cacaca;
		width: 30rpx;
		height: 30rpx;
		background: #fff;
		border-radius: 50%;
		border: 3rpx solid currentColor;
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
		box-shadow: 0 0 0 6rpx #fff;

		&::after {
			content: '';
			width: 14rpx;
			height: 14rpx;
			background: currentColor;
			border-radius: 50%;
		}

		&.active {
			color: #ff3c11;
		}
	}

	.right {
		flex: 1;
		border-left: 2rpx solid #cacaca;
		padding-left: 35rpx;
		padding-bottom: 30rpx;
		margin-left: -16rpx;

		.content-wrap {
			margin-top: -4rpx;
		}
	}

	.list-item:last-child .right {
		border: none;
	}

	.status {
		width: 111rpx;
		height: 38rpx;
		line-height: 38rpx;
		box-sizing: border-box;
		background: url('/static/status-bg.png') no-repeat center / 100% 100%;
		color: #fff;
		font-size: 24rpx;
		padding-right: 18rpx;
		text-align: right;

		&.active {
			background: url('/static/status-bg-red.png') no-repeat center / 100% 100%;
		}
	}
</style>